import QtQuick 1.1
import "Logger.js" as Logger

XmlListModel {
  id: xmlModel

  property bool loading: status == XmlListModel.Loading

  source: "http://feeds.feedburner.com/d0od?format=xml"
  query: "/rss/channel/item"
  namespaceDeclarations: "declare namespace dc='http://purl.org/dc/elements/1.1/'; declare namespace content='http://purl.org/rss/1.0/modules/content/';"

  XmlRole { name: "title"; query: "title/string()"; isKey: true }
  XmlRole { name: "pubDate"; query: "pubDate/string()" }
  XmlRole { name: "author"; query: "dc:creator/string()" }
  XmlRole { name: "url"; query: "link/string()" }
  XmlRole { name: "description"; query: "description/string()" }
  XmlRole { name: "content"; query: "content:encoded/string()" }

  onStatusChanged: {
    if (status == XmlListModel.Ready) {
      Logger.log("FeedViewModel Status: ready")
    } else if (status == XmlListModel.Error) {
      Logger.log("FeedViewModel Status: error")
    } else if (status == XmlListModel.Loading) {
      Logger.log("FeedViewModel Status: loading")
    }
  }
}
